package tools.old.files;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JRadioButton;

import account.model.Account;
import account.view.InloggenView;

public class RegistrerenController implements ActionListener {

	public RegistrerenController(JButton button){ 		
		RegistrerenView.getInstance().btnRegistreren.setActionCommand("registreren"); 		
		RegistrerenView.getInstance().btnReset.setActionCommand("reset"); 		
	} 		

	public RegistrerenController(JRadioButton radiobutton) { 		
		RegistrerenView.getInstance().StudentRDB.setActionCommand("student"); 		
		RegistrerenView.getInstance().DocentRDB.setActionCommand("docent"); 		
	}
	public void actionPerformed(ActionEvent e) {

		if(RegistrerenView.getInstance().DocentRDB.isSelected()){
			RegistrerenModel.getInstance().checkType();		
		}

		if(RegistrerenView.getInstance().StudentRDB.isSelected()){
			RegistrerenModel.getInstance().checkType();		
		}

		if ("registreren".equals(e.getActionCommand())) {
			RegistrerenModel.getInstance().registreren();
		}

		if("reset".equals(e.getActionCommand())){
			RegistrerenModel.getInstance().reset();
		}
		if("Cancel".equals(e.getActionCommand())){
			StudentRegistrerenView.getInstance().dispose();
		}
	}
}
